package com.fone.player.sns.util;

import android.content.Context;
import cn.sharesdk.framework.ShareSDK;

import com.fone.player.sns.impl.SNSLoginManager;
import com.fone.player.sns.impl.SNSShareManager;
import com.fone.player.sns.view.MyAuthorizeAdapter;
import com.fone.player.sns.view.MyQZoneWebShareAdapter;

public class SNSUtil {

	private static String TAG = "SNSUtil";
	
	public static boolean SNSPageShowing = false;
	
	/**
	 * 初始化SNS
	 * @param context
	 */
	public static void initSNS(Context context){
		ShareSDK.initSDK(context);
		ShareSDK.removeCookieOnAuthorize(true);
		ShareSDK.closeDebug();
		SNSLoginManager.iniLoginManagerInstance(context);
		SNSShareManager.iniSNSShareManager(context);
	}
	
	
	/**
	 * 关闭ShareSDK
	 * @param context
	 */
	public static void stopShareSDK(Context context){
		ShareSDK.stopSDK(context);
	}
	
	/**
	 * 设置第三方页面显示状态
	 * @param showing
	 */
	public static void setSNSPageState(boolean showing){
		SNSPageShowing = showing;
	}
	
	/**
	 * 第三方页面是否在显示
	 * @return
	 */
	public static boolean isSNSPageShowing(){
		return SNSPageShowing;
	}
	
	/**
	 * 授权页未打开前,关闭授权
	 */
	public static void stopSNS(){
		if(!SNSPageShowing){
			MyAuthorizeAdapter.open=false;
			MyQZoneWebShareAdapter.open=false;
		}
	}

	/**
	 * 是否关闭了sns开关
	 * @return
	 */
	public static boolean isSNSStop(){
		if((!MyAuthorizeAdapter.open)&&(!MyQZoneWebShareAdapter.open)){
			return true;
		}
		return false;
	}
	
}
